﻿using System.Collections;
using UnityEngine;


public static class TriUtil
{
    public static float Rand(float l)
    {
        return Random.Range(-l/2, l/2);
    }
    public static T DeepCopy<T>(T obj)
    {
        return (T)JsonUtility.FromJson(JsonUtility.ToJson(obj), obj.GetType());
    }
    public static float EPS = 1e-5f;
    public static bool FloatEqu(this float a,float b)
    {
        return Mathf.Abs(a - b) < EPS;
    }
    public static bool VecEqu(this Vector2 a,Vector2 b)
    {
        return a.x.FloatEqu(b.x) && a.y.FloatEqu(b.y);
    }
}